var xxx = (function() {
	console.log('xxx calling ..');
	function formatMillis (millis)
	{
		var secs = Math.floor (millis / 1000) % 60;
		var mins = Math.floor (millis / 1000 / 60) % 60;
		var hours = Math.floor (millis / 1000 / 60 / 60);
		return (hours === 0?"":padstrtotwo (hours) + "h ") + (mins === 0?"":padstrtotwo (mins) + "m ") + secs + "s";
	}

	function padstrtotwo (str) {
		str = str + "";
		if (str.length === 1) return "0" + str;
		return str;
	}

	var token = new Mojo.Model.Cookie('token');
	var jid = token.get() ? token.get() : 'echo';
	var pw = jid;
	jid += '@psi';

	var xxx =  {
		server: 'psi',
		url: 'http://192.168.1.37/xmpp-httpbind',
		jid: jid,
		pw: pw,
		admin: 'epic@psi',
		hasToken: function() { return token.get() ? true : false; },
		setToken: function(t) { 
			token.put(t); 
			this.jid = t + "@psi";
			this.pw = t;
		}
	};
	return xxx;
})();
